#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <cmath>

int offsetVal(std::vector<int> &nums, int offsetv)
{
    int sumv = 0;
    for (int i = 0; i < nums.size(); i++)
    {
        int nv = nums[i] + offsetv;
        if (nv < 0)
            sumv = sumv + 0;
        else if (nv > 255)
            sumv += 255;
        else
            sumv += nv;
    }

    return sumv;
}

int main()
{
    std::string istr;
    std::getline(std::cin, istr);
    std::istringstream iss(istr);

    int num;
    std::vector<int> nums;
    while (iss >> num)
    {
        nums.push_back(num);
    }

    int left = -256;
    int right = 256;
    float diff = 256;
    int curr = -256;
    while (left < right)
    {
        int mid = (left + right) / 2;
        int smv = offsetVal(nums, mid);
        float avg = (float)(smv) / nums.size();
        if (std::fabs(avg - 128) < diff)
        {
            diff = std::fabs(avg - 128);
            curr = mid;
        }
        else if (std::fabs(avg - 128) == diff)
        {
            curr = std::min(curr, mid);
        }

        if (avg - 128 > 0)
        {
            right = mid - 1;
        }
        else if (avg - 128 <= 0)
        {
            left = mid;
        }
    }

    std::cout << curr << std::endl;
    return 0;
}